import React from 'react';
import ReactDOM from 'react-dom';
import './06props.css'


class PartentCom extends React.Component{
  constructor(props){
    super(props)
  }
  render(){
    return(
      <div>
        <form action="https://baidu.com">
          <div className="child">
          <h1>helloworld</h1>
          <button onClick={this.parentEvent} >提交</button>
          </div>
        </form>
        <button onClick={(e) =>{this.parentEvent1('123')}} >提交</button>
        {/* 不用箭头函数写法 */}
        <button onClick={function(e){this.parentEvent1('123')}.bind(this)}>提交</button>
      </div>

    )
      


  }
  parentEvent = (e)=>{
    console.log(e);
    e.preventDefault()
  }
  parentEvent1 = (e) => {
    console.log(e);
    // this.parentEvent1.call(e)
  }

}





  ReactDOM.render(
    <PartentCom /> ,
    document.querySelector('#root')
  )

    // console.log(new Date()); 不会初始化






// 
// 


// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA

